//懒汉模式实现的单例模式
class SingletonLazy{
    //先把这个实例引用为null
private static volatile SingletonLazy instance=null;

private static Object locker=new Object()l
static SingletonLazy getinstance(){
    if (instance==null) {
        synchronized (locker) {
            instance = new SingletonLazy();
        }
    }
    return instance;
   }

   private SingletonLazy(){}


}
public class Demo2 {
    public static void main(String[] args) {
        SingletonLazy s1=SingletonLazy.getinstance();
        SingletonLazy s2=SingletonLazy.getinstance();
        System.out.println(s1==s2);
    }
}
